<?php session_start();?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <LINK REL=StyleSheet HREF="maintenancePagesCSS.css" TYPE="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Product Delete</title>
    </head>
<?php

print("

    <body>
        <center>
");

include "Datasource.php";
include "ProductDetails.php";
include "ProductDetailsDao.php";

//create connection to database
$connection = new Datasource("localhost","theanykey","root","");
//print("DS Good"); //Used for testing

//create dao object to interact with database
$productDetailsDao = new ProductDetailsDao();
//print("DAO Good"); //Used for testing

//create new customer valueObject and populate with data from post
$part = new ProductDetails();
$part->setProductID($_POST["PK"]);

//print("Part Good"); //Used for testing
//send valueObject to dao so that it can be added to database
if($productDetailsDao->delete($connection, &$part))
{

//Use db count method to return the valueObject from db with PK
//still dont know if this will always work
//$part = $productDetailsDao->getObject($connection, $productDetailsDao->countAll($connection));
//print($customer->toString()); //Used for testing
?>
            <p align="center"><img src="images/TitleProductDelete.gif" alt="Delete Product" width="514" height="67"></p>
            <table border="0" align="center" class="SelectTable">
                
                <tbody>
                    <tr>
                        <td>Manufacturer:</td>
                        <td> <?php print($_POST['Manufacturer']);?></td>
                    </tr>
                    <tr>
                        <td>Model Number:</td>
                        <td><?php print($_POST['Model']);  ?></td>
                    </tr>
                    <tr>
                        <td>Serial Number:</td>
                        <td><?php print($_POST['Serial']);  ?></td>
                    </tr>
                    <tr>
                        <td>Tech Notes:</td>
                        <td><?php print($_POST['TechN']);  ?></td>
                    </tr>
                    <tr>
                        <td colspan=2>
                            <div align="center"><U>Product Successfully Deleted</U> </div></td>
                    </tr>
                </tbody>
</table>

            <?php
            }//end if
            else
            {
                ?>
            <font style="color: Red">Please go back and try again.</font>
            <br/><br/>
                <?php
            }

            ?>

            <br><br>

        <script src="links.js" language="javascript" type="text/javascript"></script>
        <script type="text/javascript">
            writeProductLinks("", "");
        </script>
      </center>

    </body>
</html>
